﻿package com.wongoing.base;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 功能说明：分页结果实体类
 * 修改说明：
 * @author 郑立兵 zhenglb@mesnac.com
 * @date 2017-03-27 16:50
 * @version V1.0
 */
public class PageResult<T> implements Serializable {
	
	private Integer pageCurrent = 1;											//当前页索引
	private Integer pageSize = 10;											//每页记录数
	private Map<String, Object> param = new HashMap<String, Object>();		//传入的参数，param和where只用一个
	private String where;													//where条件字符串，where和param只用一个
	private String orderField;												//排序字段
	private String orderDirection = "ASC";										//排序方向，升序or降序
	private Integer total;												//总记录数
	private List<T> list = new ArrayList<T>();								//页面数据
	private Map<String, Object> ext = new HashMap<String, Object>();	
	public Integer getPageCurrent() {
		return pageCurrent;
	}
	
	public void setPageCurrent(Integer pageCurrent) {
		this.pageCurrent = pageCurrent;
	}
	
	public Integer getPageSize() {
		return pageSize;
	}
	
	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}
	
	public Map<String, Object> getParam() {
		return param;
	}
	
	public void setParam(Map<String, Object> param) {
		this.param = param;
	}
	
	public String getWhere() {
		return where;
	}

	public void setWhere(String where) {
		this.where = where;
	}

	public String getOrderField() {
		return orderField;
	}
	
	public void setOrderField(String orderField) {
		this.orderField = orderField;
	}
	
	public String getOrderDirection() {
		return orderDirection;
	}
	
	public void setOrderDirection(String orderDirection) {
		this.orderDirection = orderDirection;
	}

	public Integer getTotal() {
		return total;
	}

	public void setTotal(Integer total) {
		this.total = total;
	}

	public Integer getPageCount() {
		return this.total % this.pageSize == 0 ? this.total / this.pageSize : (this.total /  this.pageSize) + 1;
	}

	public List<T> getList() {
		return list;
	}

	public void setList(List<T> list) {
		this.list = list;
	}

	public Map<String, Object> getExt() {
		return ext;
	}

	public void setExt(Map<String, Object> ext) {
		this.ext = ext;
	}

	
}
